package com.cskaoyan.market.controller.admin;

import com.cskaoyan.market.annotation.RequiresPermissionsDesc;
import com.cskaoyan.market.service.AdminRegionService;
import com.cskaoyan.market.util.ResponseUtil;
import com.cskaoyan.market.vo.MarketRegionVO;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServlet;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/admin/region/")
public class AdminRegionController extends HttpServlet {

    @Autowired
    AdminRegionService regionService;

    @RequiresPermissions("admin:region:list")
    @RequiresPermissionsDesc(menu = {"商场管理", "行政区域管理"},button = "查询")
    @GetMapping("list")
    public Object list() {
        List<MarketRegionVO> regionVOList=regionService.list();
        return  ResponseUtil.okList(regionVOList);
    }
}
